#ifndef protocolhandlerinterface_h
#define protocolhandlerinterface_h

#include "xsocket.h"
#include "interfaces/initinterface.h"
#include "application.h"

typedef void*(*ninja)(int*);
class ProtocolHandlerParams{
public:
	//int proxyport;
	//char* proxyip[SP_SOCKADDRESS_LENGTH];

	int	csock;
	int	commpipe;


	ipaddress remoteaddr;


	//char	proxyaddress[SP_SOCKADDRESS_LENGTH];
	int	listenport;
	//int	inactivetimeout;
	int	rateadjustment;
	//short	fullforward;
	void*	param1;
	char*	redirecturl;
	unsigned int ratelimitup;
	unsigned int ratelimitdown;
	unsigned int pid;

};
typedef void*(*ProtocolHandlerFunction)(void*);


class ProtocolHandlerInterface{
public:
	virtual ~ProtocolHandlerInterface()=0;
	virtual void* Run(ProtocolHandlerParams*)=0;
};
inline ProtocolHandlerInterface::~ProtocolHandlerInterface(){}

class ProtocolHandlerFactoryInterface{
public:
	virtual ~ProtocolHandlerFactoryInterface()=0;
	virtual short CheckProtocol(const char*, const unsigned int)=0;
	virtual ProtocolHandlerFunction GetFunction()=0;	
	virtual ProtocolHandlerInterface* GetHandler()=0;	
	virtual const char* GetProtocolName()=0;
	virtual void* InitProtocolFactoyHanlder(InitInterface*)=0;
};
inline ProtocolHandlerFactoryInterface::~ProtocolHandlerFactoryInterface(){}
#endif
